/*
#include <REGX52.H>
------------定义----------------
#define t1 P3_0
#define L0 P1_0
#define t2 P3_1
#define L1 P1_1
#define L2 P1_2
#define L3 P1_3
#define L4 P1_4
#define L5 P1_5
#define L6 P1_6
#define L7 P1_7
#include <stdio.h>

--------延时--------------------

void Delay1000ms(void)	//@11.0592MHz
{
	unsigned char data i, j;

	i = 180;
	j = 73;
	do
	{
		while (--j);
	} while (--i);
}
---------------------------------------
void Delay20ms(void)	//@11.0592MHz
{
	unsigned char data i, j;

	i = 216;
	j = 37;
	do
	{
		while (--j);
	} while (--i);
}
-----------变量放外面------------------
int i;
---------------------------------
void main() {
-------------------流水灯------------------
	P1 = 0xFF;
	Delay1000ms();
	P1 = 0xFE;
	Delay1000ms();
	P1 = 0xFD;
	Delay1000ms();
	P1 = 0xFB;
	Delay1000ms();
	P1 = 0xF7;
	Delay1000ms();
	P1 = 0xEF;
	Delay1000ms();
	P1 = 0xDF;
	Delay1000ms();
	P1 = 0xBF;
	Delay1000ms();
	P1 = 0x7F;
	Delay1000ms();
---------------灯控制------------------
	P1 = 0xFE;
	while (1) {
		if (t1 == 0) {

			Delay20ms();
			while (t1 == 0);
			Delay20ms();

			if (P1_7 == 0) {
				P1_7 = 1;
				P1_0 = 0;
			}
			else {

				P1 = ~((~P1) << 1);

			}
		}

		if (t2 == 0) {

			Delay20ms();
			while (t2 == 0);
			Delay20ms();

			if (P1_0 == 0) {
				P1_0 = 1;
				P1_7 = 0;
			}
			else {

				P1 = ~((~P1) >> 1);

			}
		}
	}
	--------------------------------------------
		int Light[8]={1,1,1,1,1,1,1,1};
		int *p=&Light[0];
		*p=0;

		L0=Light[0];
		L1=Light[1];
		L2=Light[2];
		L3=Light[3];
		L4=Light[4];
		L5=Light[5];
		L6=Light[6];
		L7=Light[7];


			while(1){
------------------------------------
		if(t1==0){

		Delay20ms();
		while(t1==0);
		Delay20ms();
---------------------------------------
		if(p==&Light[7]){
				*p=1;
				p=&Light[0];
				*p=0;
		}
		else{
			*p=1;
			p++;
			*p=0;
		}

		L0=Light[0];
		L1=Light[1];
		L2=Light[2];
		L3=Light[3];
		L4=Light[4];
		L5=Light[5];
		L6=Light[6];
		L7=Light[7];

		}



		if(t2==0){

		Delay20ms();
		while(t2==0);
		Delay20ms();

		if(p==&Light[0]){
				*p=1;
				p=&Light[7];
				*p=0;
		}
		else{
			*p=1;
			p--;
			*p=0;
		}

		L0=Light[0];
		L1=Light[1];
		L2=Light[2];
		L3=Light[3];
		L4=Light[4];
		L5=Light[5];
		L6=Light[6];
		L7=Light[7];

		}
		}





